<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="OrdonnanceCreateDlg" widgetVar="OrdonnanceCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateOrdonnanceTitle}">

            <h:form id="OrdonnanceCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{ordonnanceController.selected != null}">

                        <p:outputLabel value="#{bundle.CreateOrdonnanceLabel_libelle}" for="libelle" />
                        <p:inputTextarea rows="4" cols="30" id="libelle" value="#{ordonnanceController.selected.libelle}" title="#{bundle.CreateOrdonnanceTitle_libelle}" />

                        <p:outputLabel value="#{bundle.CreateOrdonnanceLabel_dateOrd}" for="dateOrd" />
                        <p:calendar id="dateOrd" pattern="MM/dd/yyyy" value="#{ordonnanceController.selected.dateOrd}" title="#{bundle.EditOrdonnanceTitle_dateOrd}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateOrdonnanceLabel_idPersonne}" for="idPersonne" />
                        <p:selectOneMenu id="idPersonne" value="#{ordonnanceController.selected.idPersonne}" required="true" requiredMessage="#{bundle.EditOrdonnanceRequiredMessage_idPersonne}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{personneController.items}"
                                           var="idPersonneItem"
                                           itemValue="#{idPersonneItem}"
                                           itemLabel="#{idPersonneItem.idPersonne.toString()}"
                                           />
                            <f:converter binding="#{personneConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{ordonnanceController.saveNew}" value="#{bundle.Save}" update="display,:OrdonnanceListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,OrdonnanceCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="OrdonnanceCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
